﻿
var countryFactory = function($http, $q) {
    var factory = {};

    factory.getCountries = function () {
        var deferred = $q.defer();            
        $http.get('http://localhost:55405/api/Countries',{ cache: true})
                     .success(function (countries) {
                         deferred.resolve(countries);
                 }).error(function(error) {
                     deferred.reject(error);
                         });
         return deferred.promise;       
    };
    return factory;
};
